<p class="Paragraph">The following describes several additional options provided by <help:productname>%PRODUCTNAME</help:productname>.</p>
</help:to-be-embedded>
<p class="Head2">Assigning Macros to Specific Program Events</p>
<p class="Paragraph">In any <help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname> application you have the option of automatically executing a macro when a specified event occurs. First, though, you must assign the desired macro to the event. The possible events are available in all <help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname> programs. The following table provides an overview of program events and at what point the assigned macro is executed.</p>
<p class="TextInTable">...directly after a <help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname> program is started.</p>
<p class="TextInTable">...immediately before a <help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname> program is ended.</p>
<p class="TextInTable">...directly after a new document is created with <span class="T1">File - New</span> or with the <span class="T1">New</span> icon.</p>
<p class="TextInTable">...directly after a new document is opened with <span class="T1">File - Open</span> or with the <span class="T1">Open</span> icon.</p>
<p class="TextInTable">...immediately before a document is saved under a specified name (with <span class="T1">File - Save As</span>, or with <span class="T1">File - Save</span> or the <span class="T1">Save</span> icon, if a document name has not yet been specified).</p>
<p class="TextInTable">...directly after a document is saved under a specified name (with <span class="T1">File - Save As</span>, or with <span class="T1">File - Save</span> or with the <span class="T1">Save</span> icon, if a document name has not yet been specified).</p>
<p class="TextInTable">...immediately before a document is saved with <span class="T1">File - Save</span> or the <span class="T1">Save</span> icon, provided that a document name has already been specified.</p>
<p class="TextInTable">...directly after a document is saved with <span class="T1">File - Save</span> or the <span class="T1">Save</span> icon, provided that a document name has already been specified.</p>
<p class="TextInTable">...directly after a document is closed. <span class="T1">Note</span>: If the document was not saved since the last modification, and the user confirms the subsequent dialog with <span class="T1">Yes</span>, the "Save Document" event will automatically be executed as well.</p>
<p class="TextInTable">...directly after a document is brought to the foreground either with the corresponding entry in the Window menu, or with the key combination <help:switch select="System" xmlns:help="http://openoffice.org/2000/help"><help:case select="MAC">(Command)</help:case><help:default>(Ctrl)</help:default></help:switch> (Tab).</p>
<p class="TextInTable">...directly after another document is brought to the foreground either with the corresponding entry in the Window menu, or with the key combination <help:switch select="System" xmlns:help="http://openoffice.org/2000/help"><help:case select="MAC">(Command)</help:case><help:default>(Ctrl)</help:default></help:switch> (Tab).</p>
<p class="TextInTable">...directly after the <span class="T1">Print</span> dialog is closed, but before the actual print process begins. This event occurs for each copy printed.</p>
<p class="TextInTable">A macro assigned to an event will also be automatically executed if the respective event is provoked by a different macro!</p>
</span></th></tr></table>
<p class="Head3">Assigning a Macro to an Event</p>
<ul class="L1">
<li class="">
<p class="P2">Select the <span class="T1">Configure</span> command in the <span class="T1">Tools</span> menu and click the <text:s text:c="" xmlns:text="http://openoffice.org/2000/text"/>tab <span class="T1">Events</span>.</p>
<p class="P3">From the <span class="T1">Event</span> list box, select the type of event.</p>
</li>
<li class="">
<p class="P3">In the <span class="T1">Macro</span> list box at the left, select the object (document, template, or application) which contains the macro you want to assign to an event.</p>
</li>
<li class="">
<p class="P3">In the <span class="T1">Macro</span> list box at the right, select the desired macro (SUB).</p>
</li>
<li class="">
<p class="P3">Confirm your selection with <span class="T1">OK</span>.</p>
</li>
</ul>
<p class="Head3">Removing a Macro Assigned to an Event</p>
<ul class="L3">
<li class="">
<p class="P4">In the dialog (see above) select the event for which you want to remove the macro assignment, and click <span class="T1">Remove</span>.</p>
</li>
</ul>
<p class="Head2">Assigning a Macro to a Toolbar, Key Combination or Pull-Down Menu</p>
<p class="Paragraph">In any <help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname> application you can assign a macro (as well as any <help:productname xmlns:help="http://openoffice.org/2000/help">%PRODUCTNAME</help:productname> Basic project) to certain toolbars, define a key combination to execute a macro, or start a macro with a pull-down menu entry. Select <span class="T1">Tools - Configure</span> and click the respective tab, where you can make the desired settings.</p>